package org.joy.db2;

import java.io.IOException;

import com.sleepycat.bind.tuple.DoubleBinding;
import com.sleepycat.bind.tuple.IntegerBinding;
import com.sleepycat.db.DatabaseEntry;

public class TfIdfDB extends DB{
    public Double getEntry(int termID) throws IOException{
	DatabaseEntry keyE = new DatabaseEntry();
	IntegerBinding.intToEntry(termID, keyE);
	try {
	    DatabaseEntry valE = get(keyE);
	    if(valE.getSize() == 0){
		return null;
	    }
	    return DoubleBinding.entryToDouble(valE);
	} catch (IOException e) {
	    e.printStackTrace();
	    throw new IOException(e);
	}
    }
}
